package com.thon.service.project.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thon.dao.project.ProjectAttentionDao;
import com.thon.dao.util.Page;
import com.thon.entity.project.Project;
import com.thon.entity.project.ProjectAttention;
import com.thon.service.project.ProjectAttentionService;

@Service
@Transactional
public class ProjectAttentionServiceImpl implements ProjectAttentionService {
	
	@Autowired
	private ProjectAttentionDao projectAttentionDao;

	@Override
	public void add(ProjectAttention projectAttention) {
		
		projectAttentionDao.save(projectAttention);

	}

	@Override
	public ProjectAttention getProjectAttention(int projectAttentionId) {
		
		return projectAttentionDao.get(projectAttentionId);
	}

	@Override
	public Long countProjectAttention(int projectId) {
		
		return projectAttentionDao.countAttention(projectId);
	}

	@Override
	public void delete(Integer id) {
		projectAttentionDao.delete(id);
	}

	@Override
	public Integer getProjectAttention(Integer userId,Integer projectId) {
		return projectAttentionDao.getProjectAttention(userId, projectId);
	}

	@Override
	public List<ProjectAttention> listAttentionByPro(Project project) {
		return projectAttentionDao.listAttentionByPro(project);
	}

	@Override
	public Page<ProjectAttention> findProjectAttentionByUser(Integer userId,
			Integer pageNo, Integer pageSize) {
		Page<ProjectAttention> page=new Page<ProjectAttention>();
		page.setPageNo(pageNo);
		page.setPageSize(pageSize);
		return projectAttentionDao.findProjectAttentionByUser(userId,page);
	}
}
